load("@pybind11_bazel//:build_defs.bzl", "pybind_library")

package(
    default_visibility = ["//visibility:public"],
    licenses = ["notice"],
)

cc_binary(
    name = "_scann_ops.so",
    copts = [
        "-pthread",
    ],
    linkshared = 1,
    tags = ["local"],
    deps = [
        ":scann_ops",
        ":scann_ops_kernels",
    ],
)

cc_library(
    name = "scann_ops",
    srcs = ["ops/scann_ops.cc"],
    tags = ["local"],
    deps = [
        "//scann/oss_wrappers:tf_dependency",
    ],
    alwayslink = 1,
)

cc_library(
    name = "scann_ops_kernels",
    srcs = [
        "kernels/scann_ops.cc",
    ],
    tags = ["local"],
    deps = [
        ":scann",
        ":scann_ops_utils",
        "//scann/base:single_machine_factory_options",
        "//scann/data_format:dataset",
        "//scann/oss_wrappers:tf_dependency",
        "@com_google_absl//absl/memory",
        "@com_google_absl//absl/synchronization",
    ],
    alwayslink = 1,
)

cc_library(
    name = "scann_ops_utils",
    srcs = ["kernels/scann_ops_utils.cc"],
    hdrs = ["kernels/scann_ops_utils.h"],
    tags = ["local"],
    deps = [
        "//scann/data_format:dataset",
        "//scann/oss_wrappers:tf_dependency",
        "@com_google_absl//absl/container:inlined_vector",
        "@com_google_absl//absl/types:span",
    ],
)

cc_library(
    name = "scann",
    srcs = ["scann.cc"],
    hdrs = ["scann.h"],
    tags = ["local"],
    deps = [
        "//scann/base:search_parameters",
        "//scann/base:single_machine_base",
        "//scann/base:single_machine_factory_options",
        "//scann/base:single_machine_factory_scann",
        "//scann/data_format:dataset",
        "//scann/oss_wrappers:scann_status",
        "//scann/partitioning:partitioner_cc_proto",
        "//scann/proto:brute_force_cc_proto",
        "//scann/proto:centers_cc_proto",
        "//scann/scann_ops:scann_assets_cc_proto",
        "//scann/tree_x_hybrid:tree_x_params",
        "//scann/utils:common",
        "//scann/utils:io_npy",
        "//scann/utils:io_oss_wrapper",
        "//scann/utils:scann_config_utils",
        "//scann/utils:single_machine_retraining",
        "//scann/utils:threads",
        "//scann/utils:types",
        "@com_google_absl//absl/base",
        "@com_google_absl//absl/container:flat_hash_set",
        "@com_google_absl//absl/container:node_hash_set",
        "@com_google_absl//absl/memory",
        "@com_google_absl//absl/status:statusor",
        "@com_google_absl//absl/strings",
        "@com_google_absl//absl/synchronization",
        "@com_google_absl//absl/types:span",
        "@com_google_protobuf//:protobuf",
    ],
)

pybind_library(
    name = "scann_npy",
    srcs = ["scann_npy.cc"],
    hdrs = ["scann_npy.h"],
    tags = ["local"],
    deps = [
        ":scann",
        "//scann/base:single_machine_base",
        "//scann/base:single_machine_factory_options",
        "//scann/data_format:datapoint",
        "//scann/data_format:dataset",
        "//scann/utils:common",
        "//scann/utils:io_oss_wrapper",
        "//scann/utils:single_machine_autopilot",
        "//scann/utils:types",
        "@com_google_absl//absl/synchronization",
        "@com_google_absl//absl/types:span",
    ],
)
